/**
 * Created by dukes on 2016/2/26.
 */
class SociatyPanel extends eui.Component{
    public constructor(){
        super();
        this.skinName = "pet.SociatyPanelSkin";
        this.addEventListener(egret.Event.ADDED_TO_STAGE, this.addedToStage, this);
        this.addEventListener(egret.Event.REMOVED_FROM_STAGE, this.removedFromStage, this);
        this.y = 712;
    }

    private onGuild(evt:egret.TouchEvent){

    }

    private onFriend(evt:egret.TouchEvent){

    }

    private addedToStage(evt:egret.Event){
        this.img_guild.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onGuild, this);
        this.img_friend.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onFriend, this);
    }

    private removedFromStage(evt:egret.Event){
        this.img_guild.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onGuild, this);
        this.img_friend.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onFriend, this);
    }

    public img_guild:eui.Image;
    public img_friend:eui.Image;
    public partAdded(name:string,instance:any){
        super.partAdded(name,instance);
        if( name == "img_guild"){
            this.img_guild = instance;
        }else if( name == "img_friend"){
            this.img_friend = instance;
        }
    }

    private static _instance:SociatyPanel;
    public static getInstance():SociatyPanel{
        if( SociatyPanel._instance == null)
            SociatyPanel._instance = new SociatyPanel();
        return SociatyPanel._instance;
    }
}